package com.example.driptip.ui.home;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import com.example.driptip.model.Alarm;
import java.util.ArrayList;
import java.util.List;

public class HomeViewModel extends ViewModel {
    private final MutableLiveData<List<Alarm>> alarms;

    public HomeViewModel() {
        alarms = new MutableLiveData<>();
        List<Alarm> alarmList = new ArrayList<>();
        
        // 自定义时长闹钟
        Alarm customAlarm = new Alarm();
        customAlarm.setId("home.custom");
        customAlarm.setName("自定义时长");
        customAlarm.setType("custom");
        customAlarm.setHours(0);
        customAlarm.setMinutes(1);
        customAlarm.setSeconds(0);
        customAlarm.setRunning(false);
        customAlarm.setRepeating(false);
        alarmList.add(customAlarm);

        // 2分钟闹钟
        Alarm twoMinAlarm = new Alarm();
        twoMinAlarm.setId("home.two_min");
        twoMinAlarm.setName("2分钟");
        twoMinAlarm.setType("fixed");
        twoMinAlarm.setDuration(2 * 60); // 2分钟，以秒为单位
        twoMinAlarm.setRunning(false);
        twoMinAlarm.setRepeating(false);
        alarmList.add(twoMinAlarm);
        
        // 5分钟闹钟
        Alarm fiveMinAlarm = new Alarm();
        fiveMinAlarm.setId("home.five_min");
        fiveMinAlarm.setName("5分钟");
        fiveMinAlarm.setType("fixed");
        fiveMinAlarm.setDuration(5 * 60); // 5分钟，以秒为单位
        fiveMinAlarm.setRunning(false);
        fiveMinAlarm.setRepeating(false);
        alarmList.add(fiveMinAlarm);
        
        // 10分钟闹钟
        Alarm tenMinAlarm = new Alarm();
        tenMinAlarm.setId("home.ten_min");
        tenMinAlarm.setName("10分钟");
        tenMinAlarm.setType("fixed");
        tenMinAlarm.setDuration(10 * 60); // 10分钟，以秒为单位
        tenMinAlarm.setRunning(false);
        tenMinAlarm.setRepeating(false);
        alarmList.add(tenMinAlarm);
        
        alarms.setValue(alarmList);
    }

    public LiveData<List<Alarm>> getAlarms() {
        return alarms;
    }
}